//
// Created by xiaoma on 1/31/21.
//

#ifndef HORSE_VM_BINARYFILEPARSER_H
#define HORSE_VM_BINARYFILEPARSER_H

#include "source/util/BufferedInputStream.h"
#include "source/object/HiString.h"
#include "source/object/HiInteger.h"
#include "source/util/ArrayList.h"
#include "CodeObject.h"

class BinaryFileParser {
public:
    BinaryFileParser(BufferedInputStream *inputStream) : inputStream(inputStream) {}

    CodeObject *parse();

private:

    CodeObject *getCodeObject();

    HiString *getByteCode();

    HiString *getString();

    ArrayList<HiObject *> *getTuple();

    HiString *getName();

    HiString *getNoTableName();

    BufferedInputStream *inputStream;

    ArrayList<HiString*> stringTable;
};

#endif //HORSE_VM_BINARYFILEPARSER_H
